<?php 
    $this->Paginator->options(array('url' => $this->passedArgs));
?>

<?php echo $this->Form->create('MAvoidanceWord',array('action'=>'search'));?>
    
	<table class="multi-table table mt40">
	<tr>
		<td class="text-l w10 noborder">Avoidance Word <?php echo $this->Form->input('avoidance_word',array('label'=>'','autofocus'=>'autofocus'));?></td>	
	</tr>
	<tr>
		<td class="text-l w10 noborder">Replace Word <?php echo $this->Form->input('replace_word',array('label'=>''));?></td>
  	</tr>
  	<tr>
  		<td class="text-l w10 noborder"><?php echo $this->Form->submit('Search',array('class'=>'btn-lg noradius btn-nocolor nodecor fl'));?></td>
  	</tr>
  	</table> 

	<?php echo $this->Form->end();?>


<?php
if(!empty($searchresults)){
    echo "<table class='table table-hover table-bordered'>";
    echo "<tr>";
    echo "<td>".$this->Paginator->sort("ID","id")."</td>";
    echo "<td>".$this->Paginator->sort("Avoidance Word","avoidance_word")."</td>";
    echo "<td>".$this->Paginator->sort("Avoidance Word Yomi","avoidance_word_yomi")."</td>";
    echo "<td>".$this->Paginator->sort("Replace Word","replace_word")."</td>";
    echo "<td>".$this->Paginator->sort("Replace Word Yomi","replace_word_yomi")."</td>";
    echo "<td class='text-c' colspan='2'><a>Tools</a></td>";
    echo "</tr>";
    
    foreach($searchresults as $item){
        echo "<tr>";
        echo "<td>".$item['MAvoidanceWord']['id']."</td>";
        echo "<td>".$this->Html->link($item['MAvoidanceWord']['avoidance_word'],
		      array('controller' => 'm_avoidance_words', 'action' => 'detail', 
		      $item['MAvoidanceWord']['id']))."</td>";
        echo "<td>".$item['MAvoidanceWord']['avoidance_word_yomi']."</td>";
        echo "<td>".$item['MAvoidanceWord']['replace_word']."</td>";
        echo "<td>".$item['MAvoidanceWord']['replace_word_yomi']."</td>";
        echo "<td>".$this->Html->link('<i class="fa fa-edit"></i> EDIT',array('action' => 'edit', $item['MAvoidanceWord']['id']),array('escape' => FALSE,'class'=>'nodecor'))."</td>";
        echo "<td>".$this->Html->link('<i class="fa fa-warning "></i> DEL',array('action' => 'delete', $item['MAvoidanceWord']['id']),array('escape' => FALSE,'class'=>'nodecor'),'Are you sure?')."</td>";
        echo "</tr>";
    }
    echo "</table>";

?>

	<div class='pagination fr'>
	  	<ul>
	  		<li><span><?php echo " Page ".$this->Paginator->counter();?></span></li>
		  	<li><?php echo $this->Paginator->first(' First ', null, null, array('class' => 'disabled'));?></li>
		  	<li><?php echo $this->Paginator->prev(' Prev ', null, null, array('class' => 'disabled'));?></li>
		  	<li><?php echo $this->Paginator->numbers(array('separator' => '','first'=>false));?></li>
		  	<li><?php echo $this->Paginator->next(' Next ', null, null, array('class' => 'disabled'));?></li>
		  	<li><?php echo $this->Paginator->last(' Last ', null, null, array('class' => 'disabled'));?></li>
	 	</ul>
	</div>
	<div class="clearfix"></div>

	<?php 	}?>
	
	
	
	
	
	
	
	
	
	
	
	